package longrise.phone.com.bjjt_jyb.Activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;

import com.baidu.mobstat.StatService;

import longrise.phone.com.bjjt_jyb.R;
import longrise.phone.com.bjjt_jyb.Utils.PrefUtils;


public class SplashActivity extends Activity {

    private Handler handler = null;
    private static final int TIME = 3000;

    int count = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
                | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
        super.onCreate(savedInstanceState);
        StatService.start(this);
        setContentView(R.layout.activity_splash);
        count = PrefUtils.getInt(this, "appcount", 0);
        count++;
        PrefUtils.setInt(this, "appcount", count);
        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                Intent intent = new Intent();
                if (count == 1) {
                    intent.setClass(SplashActivity.this, GuidActivity.class);
                } else {
                    intent.setClass(SplashActivity.this, MainActivity.class);
                }
                SplashActivity.this.startActivity(intent);
                overridePendingTransition(R.anim.transition_to_anim, R.anim.transition_in_anim);
                SplashActivity.this.finish();

            }
        }, TIME);
    }
}
